﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using Recomendaciones.Entidades;


namespace Recomendaciones
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {

        }

        protected void Session_Start(object sender, EventArgs e)
        {
            HttpContext.Current.Session["usuarioID"] = null;
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {
            LogErrorServices logErrorService = new LogErrorServices();
            logErrorService.InsertarLogError(Server.GetLastError().GetType().ToString(), Server.GetLastError().StackTrace, Server.GetLastError().Message, Server.GetLastError().GetBaseException().ToString(), Server.GetLastError().Source);
            string path = HttpContext.Current.Server.MapPath("~/Paginas/ErrorPage.aspx");
            Response.Redirect(path);
            
        }

        protected void Session_End(object sender, EventArgs e)
        {
            Session["usuarioID"] = null;
        }

        protected void Application_End(object sender, EventArgs e)
        {

        }

    }
}